import { CoreModule, provideAbpCore, withOptions } from '@abp/ng.core';
import { registerLocale } from '@abp/ng.core/locale';
import { provideFeatureManagementConfig } from '@abp/ng.feature-management';
import { provideAbpOAuth } from '@abp/ng.oauth';
import { provideIdentityConfig } from '@abp/ng.identity/config';
import { provideSettingManagementConfig } from '@abp/ng.setting-management/config';
import { provideTenantManagementConfig } from '@abp/ng.tenant-management/config';
import { provideAccountConfig } from '@abp/ng.account/config';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA, LOCALE_ID } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BooksComponent } from './books/books.component';
import { KehusComponent } from './kehus/kehus.component';
import { VehicleComponent } from './Vehicle/vehicle.component';
import { OrdersComponent } from './orders/orders.component';
import { ADManagementComponent } from './admanagement/admanagement.component';
import { FleetcarComponent } from './fleetcar/fleetcar.component';
import { APP_ROUTE_PROVIDER, RouteProvider } from './route.provider';
import { InventoryTransferComponent } from './inventoryTransfer/inventory-transfer.component';
import { ThemeLeptonXModule } from '@abp/ng.theme.lepton-x';
import { SideMenuLayoutModule } from '@abp/ng.theme.lepton-x/layouts';
import { AccountLayoutModule } from '@abp/ng.theme.lepton-x/account';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { SharedModule } from './shared/shared.module';
import { OtherWarehousingComponent } from './purchase/otherwarehousing/other-warehousing.component';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { StockFlowComponent } from './report/stock-flow/stock-flow.component';

// 注册中文语言包
import { registerLocaleData } from '@angular/common';
import zh_CN from '@angular/common/locales/zh-Hans';

registerLocaleData(zh_CN);

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        HttpClientModule,
        ReactiveFormsModule,
        FormsModule,
        CommonModule,
        AppRoutingModule,
        CoreModule,
        ThemeLeptonXModule.forRoot(),
        SideMenuLayoutModule.forRoot(),
        AccountLayoutModule.forRoot(),
        ThemeSharedModule.forRoot(),
        SharedModule,
        NgxDatatableModule,
        BooksComponent,
        KehusComponent,
        VehicleComponent,
        ADManagementComponent,
        OrdersComponent,
        FleetcarComponent,
        OtherWarehousingComponent,
        InventoryTransferComponent,
        StockFlowComponent
    ],
    declarations: [
        AppComponent
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA],
    providers: [
        APP_ROUTE_PROVIDER,
        RouteProvider,
        { provide: LOCALE_ID, useValue: 'zh-Hans' },
        provideAbpCore(withOptions({
            environment,
            registerLocaleFn: registerLocale({
                cultureNameLocaleFileMap: {
                    'zh-Hans': 'zh-Hans'
                }
            }),
        })),
        provideAbpOAuth(),
        provideSettingManagementConfig(),
        provideAccountConfig(),
        provideIdentityConfig(),
        provideTenantManagementConfig(),
        provideFeatureManagementConfig()
    ],
    bootstrap: [AppComponent],
})
export class AppModule {}
